package com.yunhe.common.client.fallback;

import com.yunhe.common.client.WebItemClient;
import com.yunhe.common.model.ResultObject;
import com.yunhe.common.util.FallbackUtil;
import feign.hystrix.FallbackFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;

/**
 * @ClassName WebItemClientFallbackFactory
 * @Description TODO
 * @Author HeTao
 * @Date 2021/3/1 9:37
 * @Version 1.0
 **/
@Component
public class WebItemClientFallbackFactory implements FallbackFactory<WebItemClient> {

    @Override
    public WebItemClient create(Throwable arg0) {
        return new WebItemClient() {

            @Override
            public ResponseEntity<ResultObject> getItemByItemCodeAndEnumName(String name) {
                return FallbackUtil.getDefaultFallBack();
            }
        };
    }
}
